#存放公用的driver
#给首页公告条加上隐式等待

from selenium import webdriver
from common import comvariable
from selenium.webdriver.support.wait import WebDriverWait
import time
class BaseDriver():

    driver=webdriver.Chrome(executable_path=comvariable.driver_path_chrome)

    def __init__(self):
        self.driver.get("https://www.ctrip.com/")
        self.driver.maximize_window()
        #把首页的广告条关掉，给首页的广告条加上隐式等待

        # self.deriver.find_element_by_css_selector("#float_100_close").click()
        element=WebDriverWait(self.driver,10).until(lambda x:x.find_element_by_css_selector("#float_100_close"))
        self.driver.execute_script("arguments[0].click()",element)
        # element1=self.deriver.find_element_by_css_selector("#searchBoxUl>li:nth-child(2)")
        # self.deriver.execute_script("arguments[0].click()",element1)

# if __name__ == '__main__':
#     baseDriver=BaseDriver()

